package com.bicon.bdata_service_search.es.entities;

import com.alibaba.fastjson.annotation.JSONField;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;


@Document(indexName = "question_and_answer_realtime_index", type = "questionAndAnswerRealtime", shards = 1, replicas = 2, refreshInterval = "-1")
public class QuestionAndAnswer {

    /**爬虫问答数据ES结构 */
    /**
     * id
     **/

    @Id
    private String id;

    /**
     * 问题标题
     **/
    private String askTitle;

    /**
     * 问题来源
     */
    private String sourceWeb;
    /**
     * 问题内容
     **/
    private String askContent;
    //@IndexFileAnnontation(type = TypeEnum.TEXT,store = StoreEnum.TRUE,index = AnalyzedEnum.TRUE , analyzer = "ik_max_word" , search_analyzer = "ik_smart")

    /**
     * 问题内容涉及的疾病科室
     **/
//    @Field
    private String askDepartment;

    /**
     * 问题内容爬取地址
     **/
//    @Field
    private String askLink;

    /**
     * 问题内容数据来源
     **/

    /**
     * 客户性别
     **/
//    @Field
    private String askSex;
    private String answers;

    public String getAnswers() {
        return answers;
    }

    public void setAnswers(String answers) {
        this.answers = answers;
    }

    /**
     * 客户年龄

     **/
//    @Field
    private String askAge;
    private String askId;
    private String askTime;
    private String askContentMd5;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getAskTitle() {
        return askTitle;
    }

    public void setAskTitle(String askTitle) {
        this.askTitle = askTitle;
    }

    public String getAskContent() {
        return askContent;
    }

    public void setAskContent(String askContent) {
        this.askContent = askContent;
    }

    public String getAskDepartment() {
        return askDepartment;
    }

    public void setAskDepartment(String askDepartment) {
        this.askDepartment = askDepartment;
    }

    public String getAskLink() {
        return askLink;
    }

    public void setAskLink(String askLink) {
        this.askLink = askLink;
    }

    public String getSourceWeb() {
        return sourceWeb;
    }

    public void setSourceWeb(String sourceWeb) {
        this.sourceWeb = sourceWeb;
    }

    public String getAskSex() {
        return askSex;
    }

    public void setAskSex(String askSex) {
        this.askSex = askSex;
    }

    public String getAskAge() {
        return askAge;
    }

    public void setAskAge(String askAge) {
        this.askAge = askAge;
    }

    public String getAskId() {
        return askId;
    }

    public void setAskId(String askId) {
        this.askId = askId;
    }

    public String getAskTime() {
        return askTime;
    }

    public void setAskTime(String askTime) {
        this.askTime = askTime;
    }

    @Override
    public String toString(){
        return "askContent = "+askContent+"\n"+"askTitle = "+askTitle+"\n";
    }

    public String getAskContentMd5() {
        return askContentMd5;
    }

    public void setAskContentMd5(String askContentMd5) {
        this.askContentMd5 = askContentMd5;
    }


    @Override
    public int hashCode() {
        return id.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        QuestionAndAnswer other = (QuestionAndAnswer) obj;
        if (id == null) {
            if (other.id != null) {
                return false;
            }
        } else if (!id.equals(other.id)) {
            return false;
        }
        return true;
    }
}